"""
@author: tk
@file: 12.11作业.py
@time: 2022/12/12 19:22
"""
# 1.2
import re

lst = ["tiankai", "z54654_", "$$#@14asd"]


def a(x):
    x = str(x)
    if re.match('^[0-9a-zA-Z]+$', x[0]):
        return True
    else:
        return False


print(list(filter(a, lst)))

# 3
n = int(input("输入n:"))
from functools import reduce

a1 = lambda x, y: x * y
print(reduce(a1, range(1, n+1)))


# 4
def b(x):
    if x % 3 == 0:
        return x


print(list(filter(b, range(1, 101))))


# 5
def c(x):
    return x ** 2


print(list(map(c, range(1, 11))))


# 6
def d(x, y):
    return x * 10 + y


s = [1, 4, 5, 9]
print(reduce(d, s))

# 7小写<大写<奇数<偶数

s = 'asdf234GDSd6sf23'


def e(x):
    for i in x:
        if i.isdigit() and int(i) % 2 == 0:
            return ord(i) - 10
        else:
            return ord(i)


print(sorted(s, key=e, reverse=True))
